﻿using System.Collections.Generic;
using System.Threading;

namespace Silent.Application.Logger
{
    public class LogManager : ILogProviderAsync
    {
        private readonly List<ILogProvider> loggers = new List<ILogProvider>();

        public void Log(LogType type, object log)
        {
            loggers.ForEach(x => x.Log(type, log));
        }
        public void LogAsync(LogType type, object log)
        {
            ThreadPool.QueueUserWorkItem(o => Log(type, log));
        }
        public void AddProvider(ILogProvider provider)
        {
            loggers.Add(provider);
        }
        public void RemoveProvider(ILogProvider provider)
        {
            loggers.Remove(provider);
        }
    }
}